package jaoso.framework.dao;

import jaoso.framework.domain.Right;

import java.io.Serializable;

/**
 * @author edgeloner
 * @version 0.9.1
 * @since 2004-5-29 Right DAO, persistent Right.
 */
public interface RightDAO extends DAO
{
    /**
     * check Right name already exist
     * 
     * @param name
     *            Right name
     * 
     * @return boolean
     */
    boolean isExist(String name);

    /**
     * check Right name or desc or url already exist
     * 
     * @param right
     *            DOCUMENT ME!
     * 
     * @return DOCUMENT ME!
     */
    boolean isExist(Right right);

    /**
     * check Right name already exist
     * 
     * @param name
     *            Right name
     * @param id
     *            Right id
     * 
     * @return boolean
     */
    boolean isExist(String name, Serializable id);

    /**
     * check the right box desc or url already exist
     * 
     * @param right
     *            DOCUMENT ME!
     * 
     * @return DOCUMENT ME!
     */
    boolean isExist4u(Right right);

    /**
     * get Right by id from database
     * 
     * @param id
     *            Right id
     * 
     * @return Right if Right not fount return null
     *  
     */
    Right getRight(Serializable id);

    /**
     * get Right by box from database
     * 
     * @param box
     *            Right box
     * 
     * @return Right if Right not fount return null
     *  
     */
    Right getRightByBox(String box);

    /**
     * get Right by name from database
     * 
     * @param name
     *            Right name
     * 
     * @return Right if Right not fount return null
     *  
     */
    Right getRightByDesc(String name);

    /**
     * create a new Right
     * 
     * @param accout
     *            Right
     *  
     */
    void createRight(Right accout);

    /**
     * find Right by MyQuery
     * 
     * @return Right array
     *  
     */
    Right[] findAllRight();

    /**
     * find Right by query
     * 
     * @param query
     *            sql or hsql query
     * 
     * @return Right array
     *  
     */
    Right[] findRight(String query);

    /**
     * find all Right from database
     * 
     * @param query
     *            query
     * @return Right array
     *  
     */
    Right[] findRight(MyQuery query);

    /**
     * remove Right
     * 
     * @param right
     *            Right
     *  
     */
    void removeRight(Right right);

    /**
     * remove Right
     * 
     * @param id
     *            Right id
     *  
     */
    void removeRight(Serializable id);

    /**
     * remove Right
     * 
     * @param id
     *            Right id array
     *  
     */
    void removeRight(Serializable[] id);

    /**
     * update Right
     * 
     * @param right
     *            Right
     *  
     */
    void updateRight(Right right);
}